student_scores = []
def record_score():
    name = input("请输入学生姓名：")
    student_id = input("请输入学生学号：")
    course = input("请输入课程名称：")
    while True:
        try:
            score = float(input("请输入成绩（0-100）："))
            if 0 <= score <=100:
                break
            else:
                print("成绩必须在0到100之间，请重新输入。")
        except valueError:
            print("输入无效，请重新输入一个有效的数字。")
    student_scores.append({"姓名":name,"学号":student_id,"课程":course,"成绩":score})
    print("成绩已成功记录！")
def query_score():
    query_type = input("请选择查询方式（按姓名/学号/课程名称查询，请输入相应的关键词：")
    query_value = input(f"请输入{query_type}：")
    found = False
    for score_info in student_scores:
        if query_type == "姓名" and score_info["姓名"] == query_value:
            print(f"学生{query_value}的成绩信息：{score_info}")
            found = True
        elif query_type == "学号" and score_info["学号"] == query_value:
            print(f"学号为{query_value}的学生成绩信息：{score_info}")
            found = True
        elif query_type == "课程名称" and score_info["课程"] == query_value:
            print(f"{query_value}课程的成绩信息：{score_info}")
            found = True
    if not found:
        print(f"未找到符合条件的{query_type}为{query_value}的记录。")
while True:
    print("欢迎使用学生成绩管理系统")
    print("--------------------------")
    print("1.记录学生成绩")
    print("2.查询学生成绩")
    print("3.退出系统")
    choice = input("请输入选项序号：")
    if choice == "1":
        record_score()
    elif choice == "2":
        query_score()
    elif choice == "3":
        print("感谢使用学生成绩管理系统，再见！")
        break
    else:
        print("无效的选项，请重新输入。")